package com.gxl.design.factorypattern.factory;

import com.gxl.design.factorypattern.task.SpareParts;
import com.gxl.design.factorypattern.task.impl.Glass;
import com.gxl.design.factorypattern.task.impl.Mirror;
import com.gxl.design.factorypattern.task.impl.Tyre;

public class SparePartsFactory {

    public SpareParts production(String pro){
        if (pro == null || "".equals(pro)){
            return null;
        }
        if ("mirror".equals(pro)){
            return new Mirror();
        }
        if ("glass".equals(pro)){
            return new Glass();
        }
        if ("tyre".equals(pro)){
            return new Tyre();
        }
        return null;

    }
}
